using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

using System.Web.UI.HtmlControls;
using System.Text;
using DDNY.WebPortals.Common;

using ShopzillaV1.DataAccess;
using ShopzillaV1.Models;

namespace ShopzillaV1.Controllers
{
    [HandleError]
    public abstract class ApplicationController : Controller
    {




        public ApplicationController()
        {


            TaxonomyResponse allCats  = ShopzillaHelper.GetAllCategories();
            ViewData[VDConstants.MainCategories] = allCats.Taxonomy.Categories[0].ChildCategories;
            ViewData[VDConstants.Analytics] = "UA-1563578-81";
            ViewData[VDConstants.ResLink] = LinkManager.GetRandomResLink();



            AddMetaTags();


        }

        protected void AddMetaTags()
        {
            ViewData[VDConstants.AllMetaTags] = GetAllMetaTags();
        }

        private string GetAllMetaTags()
        {
            StringBuilder result = new StringBuilder();
            string temp = string.Format(@"<META NAME=""ROBOTS"" CONTENT=""{0},{1}"" />", ViewData[VDConstants.ShouldIndex], ViewData[VDConstants.ShouldFollow]);
            result.Append(temp);
            return result.ToString();
        }

    }
}
